package cz.muni.fi.pb138.accountingRecords;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.w3c.dom.Document;

/**
 * Interface for working with invoices for purpose of accounting records
 * @author Michal
 */
public interface InvoiceManager {

    /**
     * Adds new invoice to database
     * @param invoice invoice that will be added to DB
     */
    void addInvoice(Invoice invoice);
    
    /**
     * retrieves invoice with given ID from database
     * @param id id of invoice that will be retrieved
     * @return invoice with given id
     */
    Invoice getInvoice(String id);
    
    /**
     * retrieves invoice document with given ID from database
     * and returns it as HTML Document ready for print
     * @param id id of invoice what will be retrieved
     * @return string containing HTML document transformed from invoice with given id
     */
    String getInvoiceAsHTML(String id);
    /**
     * updates invoice with given ID in database
     * @param invoice invoice containing attributes that will be stored in database
     */
    void updateInvoice(Invoice invoice);

    /**
     * removes invoice with given ID from database
     * @param id id of invoice that will be deleted
     */
    void removeInvoice(String id);

    /**
     * retrieves from database all invoices with due date from given period
     * @param from start  of period
     * @param to end of period
     * @return list of invoices for given period
     */
    List<Invoice> getInvoicesForPeriod(Date from, Date to);

    /**
     * returns sum for all items in all invoices in given period
     * @param from start  of period
     * @param to end of period
     * @return sum for prices of all items in all invoices for given period
     */
    BigDecimal sumOfInvoicesForPeriod(Date from, Date to);
}
